package com.linwen.javase.desgin_pattern.create.clone.copy;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @ClassName Company
 * @Description
 * @Author lin
 * @Date 2022/3/13 下午8:06
 * @Version V1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Company implements Cloneable, Serializable {
    private static final long serialVersionUID = 2631590509760908280L;

    private String name;
    private String address;
    private String phone;

    private Staff staff;

    @Override
    public Company clone(){
        Company company = null;
        try {
            company = (Company)super.clone();
            company.staff = (Staff)staff.clone();
        }catch (CloneNotSupportedException e){
            e.printStackTrace();
        }
        return company;

    }
}
